import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;

public class q {
    private static final String CipherMode = "AES/ECB/PKCS5Padding";
    private static String hexString;

    static {
        q.hexString = "0123456789abcdef";
    }

    public q() {
        super();
    }

    public static String ab(String arg14) {
        String v0 = arg14;
        String v1 = "";
        String[] v2 = new String[]{"a", "b", "c", "d", "e", "f", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
        String[] v3 = new String[]{"我", "艹", "你", "妈", "逼", "$", "傻", "儿", "子", "仨", "楼", "的", "狗", "出", "来", "破"};
        int v4;
        for(v4 = 0; v4 < 16; ++v4) {
            if(v4 == 0) {
                v1 = v0.replace(v3[v4], v2[v4]);
            }

            v1 = v1.replace(v3[v4], v2[v4]);
        }

        ByteArrayOutputStream v4_1 = new ByteArrayOutputStream(v1.length() / 2);
        int v5;
        for(v5 = 0; v5 < v1.length(); v5 += 2) {
            v4_1.write(q.hexString.indexOf(v1.charAt(v5)) << 4 | q.hexString.indexOf(v1.charAt(v5 + 1)));
        }
        System.out.println(String.valueOf(v4_1.toByteArray()));
        return new String(v4_1.toByteArray());
    }

    public static String byte2hex(byte[] arg10) {
        byte[] v0 = arg10;
        StringBuffer v1 = new StringBuffer(v0.length * 2);
        int v3;
        for(v3 = 0; v3 < v0.length; ++v3) {
            String v2 = Integer.toHexString(v0[v3] & 0xFF);
            if(v2.length() == 1) {
                v1.append("0");
            }

            v1.append(v2);
        }

        return v1.toString().toUpperCase();
    }

    private static SecretKeySpec createKey(String arg10) {
        byte[] v1 = new byte[0];
        String v0 = arg10;
        if(v0 == null) {
            v0 = "";
        }

        StringBuffer v2 = new StringBuffer(0x20);
        v2.append(v0);
        while(v2.length() < 0x20) {
            v2.append("0");
        }

        if(v2.length() > 0x20) {
            v2.setLength(0x20);
        }

        StringBuffer v5 = v2;
        try {
            v1 = v5.toString().getBytes("UTF-8");
        }
        catch(UnsupportedEncodingException v5_1) {
            v5_1.printStackTrace();
        }

        return new SecretKeySpec(v1, "AES");
    }

    public static String decrypt(String arg11, String arg12) {
        String v7;
        byte[] v2 = new byte[0];
        String v1 = arg12;
        String v6 = arg11;
        try {
            v2 = q.hex2byte(v6);
        }
        catch(Exception v6_1) {
            v6_1.printStackTrace();
        }

        v2 = q.decrypt(v2, v1);
        if(v2 == null) {
            String v0 = null;
            return v0;
        }

        String v3 = null;
        try {
            v7 = new String(v2, "UTF-8");
        }
        catch(UnsupportedEncodingException v6_2) {
            v6_2.printStackTrace();
            return v3;
        }

        return  v7;
    }

    public static byte[] decrypt(byte[] arg9, String arg10) {
        byte[] v0 = arg9;
        String v6 = arg10;
        try {
            SecretKeySpec v2 = q.createKey(v6);
            Cipher v3 = Cipher.getInstance("AES/ECB/PKCS5Padding");
            v3.init(2, v2);
            v0 = v3.doFinal(v0);
        }
        catch(Exception v6_1) {
            v6_1.printStackTrace();
            v0 = null;
        }

        return v0;
    }

    public static String encrypt(String arg7, String arg8) {
        byte[] v2 = new byte['1'];
        String v1 = arg8;
        String v5 = arg7;
        try {
            v2 = v5.getBytes("UTF-8");
        }
        catch(Exception v5_1) {
            v5_1.printStackTrace();
        }

        return q.byte2hex(q.encrypt(v2, v1));
    }

    public static byte[] encrypt(byte[] arg9, String arg10) {
        byte[] v0 = arg9;
        String v6 = arg10;
        try {
            SecretKeySpec v2 = q.createKey(v6);
            System.out.println(v2);
            Cipher v3 = Cipher.getInstance("AES/ECB/PKCS5Padding");
            v3.init(1, v2);
            v0 = v3.doFinal(v0);
        }
        catch(Exception v6_1) {
            v6_1.printStackTrace();
            v0 = null;
        }

        return v0;
    }

    public static final String getMD5String(String arg17) {
        char[] v1 = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
        String v11 = arg17;
        try {
            byte[] v2 = v11.getBytes();
            MessageDigest v3 = MessageDigest.getInstance("MD5");
            v3.update(v2);
            byte[] v4 = v3.digest();
            int v5 = v4.length;
            char[] v6 = new char[v5 * 2];
            int v7 = 0;
            int v8;
            for(v8 = 0; v8 < v5; ++v8) {
                int v9 = v4[v8];
                int v12 = v7;
                ++v7;
                v6[v12] = v1[v9 >>> 4 & 15];
                v12 = v7;
                ++v7;
                v6[v12] = v1[v9 & 15];
            }

            String v0 = new String(v6);
            return v0;
        }
        catch(Exception v11_1) {
            v11_1.printStackTrace();
            return null;
        }
    }

    private static byte[] hex2byte(String arg10) {
        byte[] v0_1;
        String v0 = arg10;
        if(v0 == null || v0.length() < 2) {
            v0_1 = new byte[0];
        }
        else {
            v0 = v0.toLowerCase();
            int v1 = v0.length() / 2;
            byte[] v2 = new byte[v1];
            int v3;
            for(v3 = 0; v3 < v1; ++v3) {
                v2[v3] = ((byte)(Integer.parseInt(v0.substring(2 * v3, 2 * v3 + 2), 16) & 0xFF));
            }

            v0_1 = v2;
        }

        return v0_1;
    }

    public static String jiami(String arg13) {
        byte[] v1 = arg13.getBytes();
        StringBuilder v2 = new StringBuilder(v1.length * 2);
        int v3;
        for(v3 = 0; v3 < v1.length; ++v3) {
            v2.append(q.hexString.charAt((v1[v3] & 0xF0) >> 4));
            v2.append(q.hexString.charAt((v1[v3] & 15) >> 0));
        }

        String v3_1 = "";
        String[] v4 = new String[]{"a", "b", "c", "d", "e", "f", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
        String[] v5 = new String[]{"我", "艹", "你", "妈", "逼", "$", "傻", "儿", "子", "仨", "楼", "的", "狗", "出", "来", "破"};
        int v6;
        for(v6 = 0; v6 < 16; ++v6) {
            if(v6 == 0) {
                v3_1 = v2.toString().replace(v4[v6], v5[v6]);
            }

            v3_1 = v3_1.replace(v4[v6], v5[v6]);
        }

        return v3_1;
    }
}

